odoo.define('wechat.widget', function(require) {
    'use strict';

    const AbstractField = require('web.AbstractField');
    const registry = require('web.field_registry');

    const ImageThumbnail = AbstractField.extend({
        _render: function() {
            console.log(this.value);
            let dimension = this.nodeOptions.dimension || 64;
            if (this.value) {
                this.$el.empty().append($('<img>', {
                    src: this.value,
                    height: dimension,
                    width: dimension,
                }))
            }
        }
    });

    registry.add('ImageThumbnail', ImageThumbnail);

    return {
        ImageThumbnail: ImageThumbnail,
    }
});
